﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace Business.Models
{
    public class HocSinh
    {
        [Key]
        public int IdHocSinh { get; set; }
        public string TenHocSinh { get; set; }
        public string SoDienThoai { get; set; }
        public DateTime NgayTao { get; set; }
        public bool HoatDong { get; set; }
        public int IdLopHoc { get; set; }
        public virtual LopHoc LopHoc { get; set; }
        public int IdPhuHuynh { get; set; }
        public virtual PhuHuynh PhuHuynh { get; set; }
    }
    public class HocSinhConfiguration : EntityTypeConfiguration<HocSinh>
    {

        public HocSinhConfiguration()
            : base()
        {

            HasKey(d => d.IdHocSinh);
            Property(d => d.IdHocSinh).
                HasColumnName("IdHocSinh").
                HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity).
                IsRequired();
            Property(d => d.IdLopHoc).HasColumnName("LopHoc");
            Property(d => d.IdPhuHuynh).HasColumnName("PhuHuynh");
            ToTable("HocSinh", "dbo");
        }

    }
}